#include <iostream>
#include <vector>

using namespace std;
//  99.92 %
class Solution
{
  public:
    int minimumTotal(vector<vector<int>> &triangle)
    {
        if (triangle.size() == 0)
            return 0;
        if (triangle.size() == 1)
            return triangle[0][0];
        for (int i = triangle.size() - 2; i >= 0; i--)
        {
            for (int j = 0; j < i + 1; j++)
            {
                triangle[i][j] += triangle[i + 1][j] < triangle[i + 1][j + 1] ? triangle[i + 1][j] : triangle[i + 1][j + 1];
            }
        }
    }
};

int main()
{

    return 0;
}